package model.analyzer;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;

public class WordManager {
	private static WordTree wrdTree;
	
	public static WordTree getInstance() {
		if(wrdTree == null) {
			ObjectInputStream in;
			try {
				in = new ObjectInputStream(new FileInputStream(new File("./wordtree.dat")));

				wrdTree = (WordTree)in.readObject();
				in.close();
			} catch (FileNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (ClassNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		return wrdTree;
	}
}
